package antidestiny.utilib.msg;

import android.os.Handler;
import android.os.Message;

/**
 * Created by Hero on 2015/9/16.
 */
public class EventCar {
    MHandler handler=new MHandler();
    public static MethodManager methodManager=new MethodManager();
    private static class MethodManager {
        Method method;
    }
    public EventCar( Method m){
       // handler.setContext(context);
        methodManager.method=m;
    }
    public void sendMsg(Message msg ){
        handler.sendMessage(msg);
    }
    private static class MHandler extends Handler{
     //   WeakReference<Context> context;

     /**   public void setContext(Context context) {
            this.context = new WeakReference<>(context);
        }*/

        private MHandler(){

        }
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            methodManager.method.run(msg);
        }
/**
        public Context getContext() {
            return context.get();
        }*/
    }



}